from fastapi import (
    FastAPI,
    Cookie,
    Header,
    Path,
    Query,
    Form,
    Body,
    File,
    UploadFile,
    Depends,
    status,
    BackgroundTasks,
    HTTPException,
    Request,
    Security,
    WebSocket,
)
from fastapi.middleware.trustedhost import TrustedHostMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
import uvicorn

import osgeorouter


app = FastAPI(
    title="GYKJApp",
    description="""
    GYKJApp API helps you do awesome stuff. 🚀

    You will be able to:
    1. 有关栅格、矢量文件的所有的数据操作
    """,
    summary="This is too great!",
    version="0.0.1",
    terms_of_service="http://example.com/terms/",
    contact={
        "name": "GYKJApp",
        "url": "http://x-force.example.com/contact/",
        "email": "dp@x-force.example.com",
    },
    license_info={
        "name": "Apache 2.0",
        "url": "https://www.apache.org/licenses/LICENSE-2.0.html",
    },
    dependencies=[
        # Depends(get_current_active_user),
    ],
    openapi_tags=[
        {
            "name": "osgeotoolbox",
            "description": "有关栅格、矢量文件的所有的数据操作。",
        },
    ],
    swagger_ui_parameters={"syntaxHighlight.theme": "obsidian"},
    openapi_url="/openapi.json",
    docs_url="/doc", # None
    redoc_url="/redoc", # None
    )
app.add_middleware(GZipMiddleware, minimum_size=1000)
app.add_middleware(TrustedHostMiddleware, allowed_hosts=["*"])
app.include_router(osgeorouter.router)
 

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8002)